<template>
	<view class="container">
		<uni-forms ref="form" :rules="{}">
			<uni-forms-item label="" name="">
			<uni-easyinput  v-model="newUser.telephone" placeholder="请输入手机号" />	
			</uni-forms-item>
			<uni-forms-item label="" name="">
			<uni-easyinput  v-model="newUser.password" placeholder="设置密码" />	
			</uni-forms-item>
		</uni-forms>
		
		<button type="primary" @click="register">注册</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			newUser:{
				telephone:null,
				password:null
				
			},
			repassword:null
			}
		},
		methods: {
register(){
	uni.request({
		url: 'http://localhost:8090/foodapp/user/register',
		method: 'POST',
		data: this.newUser,
		success: res => {
			if(res.data.success){
			
					uni.navigateTo({
						url:"../login/login"
					});
		
			
				}else{
				uni.showToast({
					icon:"none",
					title:"注册失败"
				})					
			}
		},
		fail: () => {
			uni.showToast({
				icon:"none",
				title:"网络错误"
			})
		},
		complete: () => {}
	});
}
		},
		onLoad: () => {
			uni.onTabBarMidButtonTap(function(e){
				console.log(e)
				
			})
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
